<template>
	<view>
		<view class="header">
		
			<image src="../../static/zuo.png" mode="" style="width: 45upx;height: 45upx;" @click="back"></image>
		</view>
		<view class="onelist">
<!-- 			<h3 style="padding-left: 30upx;">职位名称</h3> -->
			<view class="twolist" v-for="item in zhilist" @click="show(item.id)">
				<text>{{item.name}}</text>
				<image src="@/static/tuo.png" mode=""
					style="width: 30upx;height: 30upx;padding-right: 0upx;">
				</image>
			</view>
		</view>
		<jobSelect ref="jobSelect" :listData="listData" @confirem="confiremJob"></jobSelect>
	</view>
</template>

<script>
		import jobSelect from '@/components/yunmiao-jobSelect/yunmiao-jobSelect.vue'
	export default {
		data() {
			return {
				zhilist: [],
				listData: [],
				zhiweiId :'',
				cateid:'',
				zhanid:'',
			}
		},
		onLoad(option) {
			uni.request({
				url: 'https://dsx.cdzer.com/api/Job/getposition', //仅为示例，并非真实接口地址。
				method: 'POST',
				header: {
					'content-type': 'application/x-www-form-urlencoded',
				},
				success: (res) => {
					console.log(res, "职位分类列表")
					this.zhilist = res.data.data
				}
			});
			this.cateid = option.cateid
			this.zhanid = option.zhanid
		},
		components: {
			jobSelect,
		},
		methods: {
			back() {
				uni.navigateBack({
					delta: 1
				})
			},
			confiremJob(e) {
				console.log(e)
				var zhiname = e.name
				var jobid = e.id
				uni.navigateTo({
					url:`./morepin?zhiname=${zhiname}&cateid=${this.cateid}&zhanid=${this.zhanid}&jobid=${jobid}`
				})
			},
			show(id) {
				this.zhiweiId = id
				uni.request({
					url: 'https://dsx.cdzer.com/api/Job/getpositionlist', //仅为示例，并非真实接口地址。
					method: 'POST',
					data: {
						cate_id: id
					},
					header: {
						'content-type': 'application/x-www-form-urlencoded',
					},
					success: (res) => {
						console.log(res, "岗位列表")
						if (res.data.status == 200) {
							this.listData = res.data.data
							this.$refs.jobSelect.show()
						}
					}
				});
			},
		}
	}
</script>

<style lang="scss">
	.header {
		position: fixed;
		background-color: #fff;
		height: 110upx;
		width: 100%;
		top: 0;
		left: 0;
		display: flex;
		z-index: 100;
		align-items: center;
		padding-left: 30upx;
	}
	.onelist {
		width: 100%;
		height: 1440upx;
		background-color: #FFFFFF;
		display: flex;
		padding-bottom: 40upx;
		flex-direction: column;
		
		.twolist {
			display: flex;
			padding: 30upx;
			justify-content: space-between;
			border-bottom: 2upx solid #EEEEEE;
			width: 100%;
		}
	}
</style>
